import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'  

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [ uni()],
  server:{
  	  proxy:{
  		  "/v1":{
  			  target:"https://ucenter-api.xgimi.com",
  			  changeOrigin:true,
  			   onProxyReq(req){
  			   // 骗小米服务器，来请求的页面是  "https://m.mi.com/
			    req.setHeader("Origin","https://account-center.xgimi.com")
				  req.setHeader("Content-Type","application/json");
				   req.setHeader("Content-Type","application/json");
  			       req.setHeader("referer","https://account-center.xgimi.com/");
  			       req.setHeader("X-XSRF-TOKEN","eyJpdiI6Imx6amoyVUpXNWZUQlhIcnZadG1aRGc9PSIsInZhbHVlIjoiNllqU3BzSXZrckY0R2NZRk5WMEhKcnd0eWZOQlVvXC9QUnF6WDRwK3YxRmF4Qm1uTFJ3TytGYUtzayt3Z2Nud3dYY1hDa1NQUmVEUk1iZUxoUHdXZXFRPT0iLCJtYWMiOiI0M2RiYWVkY2U2N2U0MDJhY2MzMGU5YjNiNDYwYzZlN2FlOWEwOTllY2FlZTVmNjAwOTRmYWU5MGMxZDQyNTgwIn0="); 
  			       req.setHeader("Cookie","HTTP-REFERER=aHR0cHM6Ly9tLnhnaW1pLmNvbS8%3D; cookieKey=1678846983342; cartNumber=0; XSRF-TOKEN=eyJpdiI6Imx6amoyVUpXNWZUQlhIcnZadG1aRGc9PSIsInZhbHVlIjoiNllqU3BzSXZrckY0R2NZRk5WMEhKcnd0eWZOQlVvXC9QUnF6WDRwK3YxRmF4Qm1uTFJ3TytGYUtzayt3Z2Nud3dYY1hDa1NQUmVEUk1iZUxoUHdXZXFRPT0iLCJtYWMiOiI0M2RiYWVkY2U2N2U0MDJhY2MzMGU5YjNiNDYwYzZlN2FlOWEwOTllY2FlZTVmNjAwOTRmYWU5MGMxZDQyNTgwIn0%3D; sajssdk_2015_cross_new_user=1; laravel_session=eyJpdiI6IktROEF4Rm9BM29xT3pjeG52MlpMd0E9PSIsInZhbHVlIjoiVDN4R2ZXNm5sWFB6MGhDaVlcL21qdW5SZkZxY2ZDNHZpUmg2RnJaY1RFZ0VoeGEzSXBZSUZZTmFYdytVTXk2SVNYQzJmYmREaWZvSlRsSzE0RUg1N3pRPT0iLCJtYWMiOiJjMGFmMzQxNDhiMjc5NzA0YzczYzRhNDAwMjQ4YmE5MTgzNWNlMzdjNDBiZTZhZTA4ZjJhYWViYTBhMGU3YWVhIn0%3D; sensorsdata2015jssdkcross=%7B%22distinct_id%22%3A%22186e31418cc2b6-060558326bd7da-5437971-250125-186e31418cd9e9%22%2C%22first_id%22%3A%22%22%2C%22props%22%3A%7B%7D%2C%22%24device_id%22%3A%22186e31418cc2b6-060558326bd7da-5437971-250125-186e31418cd9e9%22%2C%22identities%22%3A%22eyIkaWRlbnRpdHlfYW5vbnltb3VzX2lkIjoiMTg2ZTMxNDE4Y2MyYjYtMDYwNTU4MzI2YmQ3ZGEtNTQzNzk3MS0yNTAxMjUtMTg2ZTMxNDE4Y2Q5ZTkiLCIkaWRlbnRpdHlfY29va2llX2lkIjoiMTg2ZTMxNDVkNTQ1ZDEtMDQ1MDM5NGY2ZjA5ZTc0LTU0Mzc5NzEtMjUwMTI1LTE4NmUzMTQ1ZDU1ZmY1In0%3D%22%2C%22history_login_id%22%3A%7B%22name%22%3A%22%22%2C%22value%22%3A%22%22%7D%7D; HWWAFSESID=5774b764960e616441; HWWAFSESTIME=1678847020631")
  			  }
  		  }
  	  }
  }
})
